package work;
/*
2	公鸡五元钱一只，母鸡三元钱一只，小鸡一元钱三只，现有一百元钱欲买百鸡，共有多少种买法 6分
 (假设每种至少要买一只)
 */
public class Work07_2 {
    public static void main(String[] args) {
        int count = 0;

        for (int cock = 1; cock <= 20; cock++) {
            for (int hen = 1; hen <= 33-cock; hen++) {

                int chickens = (100 - 5 * cock - 3 * hen) * 3 / 1;
                if (chickens % 3 == 0 && cock + hen + chickens == 100) {

                    System.out.println("公鸡: " + cock + " 只, 母鸡: " + hen + " 只, 小鸡: " + chickens / 3 + " 只");
                    count++;
                }
            }
        }

        System.out.println("共有 " + count + " 种买法");
    }
}
